﻿#!/usr/bin/env python3
import os, sys, shutil
from string import digits
import xlrd
import xlwt
from xlutils.copy import copy
import re
import multiprocessing
import time

# 移动文件夹path中的某一个文件或文件夹file到某路径destination
from n3_dataSave import excle


def read_excel_xls(path):
    workbook = xlrd.open_workbook(path)  # 打开工作簿
    sheets = workbook.sheet_names()  # 获取工作簿中的所有表格
    worksheet = workbook.sheet_by_name(sheets[0])  # 获取工作簿中所有表格中的的第一个表格
    data = []
    for i in range(0, worksheet.nrows):
        d = []
        for j in range(0, worksheet.ncols):
            d.append(worksheet.cell_value(i, j))
            # data[i][j]=worksheet.cell_value(i, j)
            # print(worksheet.cell_value(i, j), "\t", end="")  # 逐行逐列读取数据
        # print()
        data.append(d)
    return data


def MoveOneFile(myfile, path, destination):
    if not os.path.exists(path):
        sys.stderr.write("Error! The path inputed is not exist")
        exit(1)
    if not os.path.exists(destination):
        sys.stderr.write("Error! The destination inputed is not exist")
        exit(1)
    myfile_src = os.path.join(path, myfile)
    if not os.path.exists(myfile_src):
        sys.stderr.write("Error! The file inputed is not exist")
        exit(1)
    myfile_dst = os.path.join(destination, myfile)
    if os.path.exists(myfile_dst):
        sys.stderr.write("Error! The file in destination is already exist")
        exit(1)
    shutil.move(myfile_src, destination)


# 将路径dir下所有名为myfile的文件改名为changed_name,包括目录dir下的所有子文件夹
def RenameFile(myfile_name, path, changed_name):
    for dirpath, dirnames, files in os.walk(path):
        for filename in files:
            if filename == myfile_name:
                file_rename_path = os.path.join(dirpath, filename)
                os.rename(file_rename_path, changed_name)
                print("{} file name is changed into {}".format(file_rename_path, changed_name))


# 提取文件夹是数字的文件提取出来
def extractFile2(path):
    for dirpath, dirnames, files in os.walk(path):
        for file in files:
            if (os.path.basename(dirpath).isdigit()):
                f1 = os.path.join(dirpath, file)
                f2 = os.path.join(os.path.dirname(dirpath), file)
                print(f1, "------", f2)
                if (file == "Thumbs.db"):
                    os.remove(f1)
                else:
                    shutil.move(f1, f2)
    for dirpath, dirnames, files in os.walk(path):
        for dirname in dirnames:
            if (dirname.isdigit()):
                f1 = os.path.join(dirpath, dirname)
                print(f1)
                os.rmdir(f1)


# 将文件名称包含filterNames名称的从dir目录复制到newDir  针对协查函 从dir（X:\caojia\百信2004 -21\bx-003）  filterNames（1-2民事起诉状.jpg，2-1.1原告工商登记复印件.jpg）newDir
def extractFile(dir, filterNames, newDir):
    for dirpath, dirnames, files in os.walk(dir):
        for filename in files:
            if filename in filterNames:
                new_dir = str.replace(dirpath, dir, newDir)
                if not os.path.exists(new_dir):
                    os.makedirs(new_dir)
                old_file = os.path.join(dirpath, filename)
                new_file = os.path.join(new_dir, filename)
                if not os.path.exists(new_file):
                    shutil.copyfile(old_file, new_file);
                print("{} file name is changed into {}".format(old_file, new_file))


# 提取文件夹，根据案号提取文件夹出来
def extractDir(dir, filterNames, newDir):
    for dirpath, dirnames, files in os.walk(dir):
        for dirname in dirnames:
            str = dirname.split('_')
            flag = 0
            for s in str:
                if (s in filterNames):
                    flag = 1
                    break
            if (flag):
                f1 = os.path.join(dirpath, dirname)
                f2 = os.path.join(newDir, dirname)
                print(f1, "------->", f2)
                shutil.move(f1, f2)


# 提取文件夹，根据名称提取文件夹出来
def extractDir1(dir, filterNames, newDir):
    remove_digits = str.maketrans('', '', digits)
    for dirpath, dirnames, files in os.walk(dir):
        for dirname in dirnames:
            dirname1 = dirname.translate(remove_digits)
            if dirname1 in filterNames:
                f1 = os.path.join(dirpath, dirname)
                f2 = os.path.join(newDir, dirname)
                shutil.move(f1, f2)


# 移动文件夹 从path1 移动到path2 针对判决书 里面文件名称相同
def moveFile(path1, path2):
    list = os.listdir(path2)
    for dirpath, dirnames, files in os.walk(path1):
        for dirname in dirnames:
            if dirname in list:
                f1 = os.path.join(path1, dirname)
                f2 = os.path.join(path2, dirname)
                print(f1, "------->", f2)
                for dirpath, dirnames, files in os.walk(f1):
                    for fName in files:
                        f3 = os.path.join(path1, dirname, fName)
                        if not (fName == 'Thumbs.db'):
                            shutil.move(f3, f2)


# 移动文件夹 从path1 移动到path2 针对并案处理
def moveFile1(path1, path2):
    remove_digits = str.maketrans('', '', digits)
    list = os.listdir(path2)
    for dirpath, dirnames, files in os.walk(path1):
        for dirname in dirnames:
            dirname1 = dirname.translate(remove_digits)
            for name in list:
                if dirname1 + ',' in (name + ','):
                    f1 = os.path.join(path1, dirname)
                    f2 = os.path.join(path2, name)
                    for dirpath, dirnames, files in os.walk(f1):
                        for fName in files:
                            f3 = os.path.join(path1, dirname, fName)
                            f4 = os.path.join(path2, name, fName)
                            if not os.path.exists(f4):
                                print(f3, "------->", f2)
                                if not (fName == 'Thumbs.db'):
                                    shutil.move(f3, f2)


def margerDir(path, path2):
    listDir = os.listdir(path)
    listDir2 = os.listdir(path2)
    for dirname in listDir:
        flag = 0
        for dirname2 in listDir2:
            nameList = dirname.split("_")
            for name in nameList:
                if name in dirname2:
                    f = os.path.join(path, dirname)
                    f1 = os.path.join(path, dirname2)
                    if not os.path.exists(f1):
                        os.rename(f, f1)
                        print(f + "---->" + f1)
                    # f2 = os.path.join(path2)
                    # print(f1+"---->"+f2)
                    flag = 1
                    # shutil.move(f1,f2)
                    break
            if flag:
                break


# 对比listDir列表 在listDirs表中都存在的
def comFileDirName(listDir, *listDirs):
    for name in listDir:
        flag = comp(listDirs, name, len(listDirs) - 1)
        if flag:
            print(name)


# 查找出没有在listDirs中的元素
def compNotFileDirName(listDir, listDirs):
    for name in listDir:
        if name not in listDirs:
            print(name)


def comp(listDirs, name, i):
    flag = 0
    for dir in listDirs[i]:
        if dir.find(name) >= 0:
            flag = 1
            # print(str(flag)+","+str(i))
            break
    if (i == 0):
        return flag
    if (flag):
        return comp(listDirs, name, i - 1)
    else:
        flag = 0
        return flag


# 诉讼与执行合并
# file 诉讼文件夹  dir 执行文件夹 e 对应关系excle
# 2，3，4 表示excle中对应 执行案号，诉讼案号，被告名称的位置列 从0开始
def classDir(file, dir, e):
    data = read_excel_xls(e)
    for row in data:
        # print(row)
        f = os.path.join(file, row[2] + "_" + row[3])
        dirPath = os.path.join(dir, row[1] + "_" + row[3])
        # print(f + ">>>>>" + dirPath)
        if not os.path.exists(f):
            continue
        if not os.path.exists(dirPath):
            continue
        for p in os.listdir(f):
            path = os.path.join(f, p)
            if not os.path.exists(os.path.join(dirPath, p)):
                print(path + ">>>>>" + dirPath)
                shutil.move(path, dirPath)


# 将文件复制到文件夹中 根据excel中的字段
# path文件路径 ，dest文件夹路径，e excel文件路径，excel_location_file 文件匹配位置在excle中，excel_location_dir 文件夹的名称没有就创建文件夹
# path,dir,e, [1], [0, 5, 1, 5, 2]
def fileClass(path, dest, e, excel_location_file, excel_location_dir):
    data = read_excel_xls(e)
    file_list = os.listdir(path)
    for row in data:
        name = ""
        dir_name = ""
        for n in excel_location_file:
            if type(row[n]) is float:
                name = name + str(int(row[n]))
            else:
                name = name + str(row[n])
        for n in excel_location_dir:
            if type(row[n]) is float:
                dir_name = dir_name + str(int(row[n]))
            else:
                dir_name = dir_name + str(row[n])
        if name == '':
            continue
        if dir_name == '':
            continue
        for file_name in file_list:
            if name in file_name:
                file_path = os.path.join(path, file_name)
                path_dest = os.path.join(dest, dir_name)
                if not os.path.exists(path_dest):
                    os.makedirs(path_dest)
                print(file_path + ">>>>>>>>>>>" + path_dest)
                shutil.copy(file_path, path_dest)
    pass


# 在文件或文件夹外层增加文件夹
# path 文件路径，
# dest存放处理完的文件路径
# req path下的文件名称的切割规则（正则表达式）
# location 新文件夹的命名取值于req切割字符串后的数组位置
# break_point 新文件夹的命名时 各个位置之间的连接字符串
# add_dir_from_file(r'Z:\诉前调解文书送达相关\信喜已加章调解书 - 副本',
#                 r'Z:\诉前调解文书送达相关\信喜已加章调解书 - 副本1', '_', [0, 1], '_')
def add_dir_from_file(path, dest, req, location, break_point):
    list = os.listdir(path)
    for file_name in list:
        ss = re.split(req, file_name)
        dir_name = ''
        flag = 1
        for i in location:
            if flag:
                dir_name = dir_name + str(ss[i])
                flag = 0
            else:
                dir_name = dir_name + break_point + str(ss[i])
        path_dest = os.path.join(dest, dir_name)
        file_path = os.path.join(path, file_name)
        if not os.path.exists(path_dest):
            os.makedirs(path_dest)
        shutil.copy(file_path, path_dest)


def rename_dir(dir, e, location_dir, location_dest):
    print(e)
    data = read_excel_xls(e)
    file_list = []
    for dirpath, dirnames, files in os.walk(dir):
        for dirname in dirnames:
            file_list.append([dirname, dirpath])
    for row in data:
        row.append("-")
        row.append("_")
        name = ""
        dir_name = ""
        for n in location_dir:
            if type(row[n]) is float:
                name = name + str(int(row[n]))
            else:
                name = name + str(row[n])
        for n in location_dest:
            if type(row[n]) is float:
                dir_name = dir_name + str(int(row[n]))
            else:
                dir_name = dir_name + str(row[n])
        for file in file_list:
            if name in file[0]:
                file_path = os.path.join(file[1], file[0])
                path_dest = os.path.join(file[1], dir_name)
                if not os.path.exists(path_dest):
                    # os.makedirs(path_dest)
                    print(file_path + ">>>>>>>>>>>" + path_dest)
                    os.rename(file_path, path_dest)  # 替换
                    # copy_dir(file_path, path_dest)
                break


def copy_dir(dir, dest):
    for dirpath, dirnames, files in os.walk(dir):
        for filename in files:
            file_path = os.path.join(dirpath, filename)
            path_dest = os.path.join(dest, filename)
            if not filename in "Thumbs.db":
                shutil.copy(file_path, path_dest)


if __name__ == "__main__":
    # rename_dir(r'Z:\10月份海通1000案\应诉文书扫描件\海通1000案传票扫描件\分类后\10'
    #            , r'C:\Users\jin\Desktop\海通10-2立案分庭(1).xlsx'
    #            , [1], [1, 4, 3])
    # , [6], [6, 4, 8])
    fileClass(r'Y:\海通 第二批8-27\海通立案1000证据\批量放入文件\债权通知书1\11'
              , r'Y:\海通 第二批8-27\海通立案1000证据\批量放入文件\债权通知书1\112',
              r'Y:\秧\海通10-26立案\海通立案1000(有案号)10-16.xlsx', [3], [2,51,4])

    # thread_list =[]
    # for dirpath, dirnames, files in os.walk(r'Y:\海通 第二批8-27\海通第二批1600单\表格\9-27\1000'):
    #     for filename in files:
    #         if 'yr' not in filename:
    #             continue
    #         path = os.path.join(dirpath, filename)
    #         path2 =  os.path.join(r'Y:\海通 第二批8-27\海通第二批1600单\证据包\立案后9.28\身份证', filename.split('.')[0])
    #         # if not os.path.exists(path2):
    #         try:
    #             p = multiprocessing.Process(
    #                 target=rename_dir, args=(
    #                     r'Y:\海通 第二批8-27\海通第二批1600单\证据包\海通1400+100原始资料\1400+100身份证\身份证1400-1500',
    #                                          path2,path,
    #                                          [2, -2, 3], [1, -1, 3]))  # 创建一个进程，args传参 必须是元组
    #             p.start()
    #             thread_list.append(p)
    #         except Exception:
    #             print ("Error: 没有找到文件或读取文件失败")
    # for t in thread_list:
    #     t.join()

    # classDir(r'Y:\秧\执行\九月份执行200',r'Z:\执行相关\执行送达文件 9.4',r'C:\Users\jin\Downloads\2020.9执行(3)(1).xlsx最新表(1).xlsx')
    # add_dir_from_file(r'Y:\海通7454-7508判决书扫描件',
    #                   r'Y:\海通7454-7508判决书扫描件1', '\.', [0], '')
    # path = os.listdir(r"\\free-die\F\海通 第二批8-27\海通第二批1600单\证据包\海通1400+100原始资料\1400+100身份证\身份证2")
    # path1 = os.listdir(r"\\free-die\F\海通 第二批8-27\海通第二批1600单\证据包\海通1400+100原始资料\1400+100身份证\身份证1-doc-pdf")
    # path2 = os.listdir(r"\\free-die\F\海通0907\缺少")
    # path3 = os.listdir(r"\\free-die\F\海通 第二批8-27\海通第二批1600单\证据包\海通1400+100原始资料\1400+100注册登记表\111")

    list = "合同编号 CG15000378 CG15000378 CG15000608 CG15000608 CG15000688 CG15000688 CG15000929 CG15000929 CG15000939 CG15000939 CG15001037 CG15001037 CG15001066 CG15001066 CG15001090 CG15001090 CG15001261 CG15001261 CG15001408 CG15001408 CG15001664 CG15001664 CG15001838 CG15001838 CG15001995 CG15001995 CG15002092 CG15002092 CG15002119 CG15002119 CG15002122 CG15002122 CG15002159 CG15002159 CG15002248 CG15002248 CG15002252 CG15002252 CG15002297 CG15002297 CG15002310 CG15002310 CG15002335 CG15002335 CG15002430 CG15002430 CG15002433 CG15002433 CG15002449 CG15002449 CG15002595 CG15002595 CG15002643 CG15002643 CG15002661 CG15002661 CG15002754 CG15002754 CG15002785 CG15002785 CG15002832 CG15002832 CG15002969 CG15002969 CG15003181 CG15003181 CG15003214 CG15003214 CG15003240 CG15003240 CG15003410 CG15003410 CG15003521 CG15003521 CG15003522 CG15003522 CG15003747 CG15003747 KCE17040283 KCE17040283 KCE17042246 KCE17042246 KCE17043042 KCE17043042 KCE17049116 KCE17049116 KCE17062036 KCE17062036 KCE17067277 KCE17067277 KCE17068104 KCE17068104 KCE17068241 KCE17068241 KCE17068946 KCE17068946 KCE17069170 KCE17069170 KCE17069274 KCE17069274 KCE17069306 KCE17069306 KCE17069411 KCE17069411 KCE17072294 KCE17072294 KCE17073700 KCE17073700 KCE17073854 KCE17073854 KCE17074237 KCE17074237 KCE17074332 KCE17074332 KCE17074642 KCE17074642 KCE17078246 KCE17078246 KCE17080072 KCE17080072 KCE17080106 KCE17080106 KCE17080227 KCE17080227 KCE17081476 KCE17081476 KCE17086083 KCE17086083 KCE17086172 KCE17086172 KCE17087605 KCE17087605 KCE17087644 KCE17087644 KCE17087929 KCE17087929 KCE17088097 KCE17088097 KCE17088826 KCE17088826 KCE17090985 KCE17090985 KCE17092064 KCE17092064 KCE17093101 KCE17093101 KCE17093836 KCE17093836 KCE17094821 KCE17094821 KCE17094962 KCE17094962 KCE17095051 KCE17095051 KCE17096643 KCE17096643 KCE17099811 KCE17099811 KCE17099827 KCE17099827 KCE17100017 KCE17100017 KCE17100659 KCE17100659 KCE17100745 KCE17100745 KCE17102830 KCE17102830 KCE17103456 KCE17103456 KCE17106040 KCE17106040 KCE17106239 KCE17106239 KCE17107117 KCE17107117 KCE17108901 KCE17108901 KCE17108951 KCE17108951 KCE17109101 KCE17109101 KCE17109210 KCE17109210 KCE17110883 KCE17110883 KCE17111227 KCE17111227 KCE17111636 KCE17111636 KCE17111699 KCE17111699 KCE17112600 KCE17112600 KCE17114094 KCE17114094 KCE17114704 KCE17114704 KCE17117679 KCE17117679 KCE17118526 KCE17118526 KCE17120899 KCE17120899 KCE17124043 KCE17124043 KCE17125417 KCE17125417 KCE17130109 KCE17130109 KCE17135452 KCE17135452 KCE17138791 KCE17138791 KCE17139914 KCE17139914 KCE17140595 KCE17140595 KCE17141625 KCE17141625 KCE17146914 KCE17146914 KCE17150162 KCE17150162 KCE17150290 KCE17150290 KCE17151517 KCE17151517 KCE17153334 KCE17153334 KCE18000124 KCE18000124 KCE18000633 KCE18000633 KCE18007354 KCE18007354 KCE18008933 KCE18008933 KCE18010010 KCE18010010 KCE18010320 KCE18010320 KCE18013012 KCE18013012 KCE18030923 KCE18030923 KCE18117184 KCE18117184 KCE18119795 KCE18119795 KCE18128959 KCE18128959 KCE18131167 KCE18131167 KCE18219882 KCE18219882 KCE18223365 KCE18223365 KCG0008587 KCG0008587 KCG0008956 KCG0008956 KCG0009242 KCG0009242 KCG0009287 KCG0009287 KCG0009316 KCG0009316 KCG0009357 KCG0009357 KCG0009428 KCG0009428 KCG16001009 KCG16001009 KCG16002205 KCG16002205 KCG16003244 KCG16003244 KCG16003302 KCG16003302 KCG16004499 KCG16004499 KCG16004861 KCG16004861 KCG16006043 KCG16006043 KCG16006150 KCG16006150 KCG16006875 KCG16006875 KCG16007425 KCG16007425 KCG16010601 KCG16010601 KCG16011825 KCG16011825 KCG16013873 KCG16013873 KCG16013962 KCG16013962 KCG16014474 KCG16014474 KCG16014519 KCG16014519 KCG16017140 KCG16017140 KCG16017157 KCG16017157 KCG16018322 KCG16018322 KCG16019630 KCG16019630 KCG16020187 KCG16020187 KCG16020547 KCG16020547 KCG16022316 KCG16022316 KCG16022338 KCG16022338 KCG16023626 KCG16023626 KCG16024146 KCG16024146 KCG16024325 KCG16024325 KCG16025649 KCG16025649 KCG16025653 KCG16025653 KCG16029021 KCG16029021 KCG16031017 KCG16031017 KCG16031184 KCG16031184 KCG16031200 KCG16031200 KCG16031358 KCG16031358 KCG16032016 KCG16032016 KCG16032671 KCG16032671 KCG16032812 KCG16032812 KCG16033179 KCG16033179 KCG16034033 KCG16034033 KCG16035808 KCG16035808 KCG16037622 KCG16037622 KCG16038217 KCG16038217 KCG16039570 KCG16039570 KCG16040431 KCG16040431 KCG16044221 KCG16044221 KCG16044452 KCG16044452 KCG16044659 KCG16044659 KCG16045317 KCG16045317 KCG16047013 KCG16047013 KCG16048072 KCG16048072 KCG16048618 KCG16048618 KCG16049795 KCG16049795 KCG16051979 KCG16051979 KCG16052038 KCG16052038 KCG16053143 KCG16053143 KCG16053580 KCG16053580 KCG16053868 KCG16053868 KCG16055021 KCG16055021 KCG16055291 KCG16055291 KCG16056896 KCG16056896 KCG16058958 KCG16058958 KCG16063823 KCG16063823 KCG16064174 KCG16064174 KCG16064790 KCG16064790 KCG16064812 KCG16064812 KCG16065385 KCG16065385 KCG16065729 KCG16065729 KCG16065932 KCG16065932 KCG16067054 KCG16067054 KCG16067663 KCG16067663 KCG16068389 KCG16068389 KCG16068644 KCG16068644 KCG16070902 KCG16070902 KCG16071528 KCG16071528 KCG16071829 KCG16071829 KCG16071859 KCG16071859 KCG16071989 KCG16071989 KCG16074436 KCG16074436 KCG16075089 KCG16075089 KCG16075797 KCG16075797 KCG16076306 KCG16076306 KCG16079145 KCG16079145 KCG16079600 KCG16079600 KCG16079818 KCG16079818 KCG16080107 KCG16080107 KCG16080115 KCG16080115 KCG16080470 KCG16080470 KCG16081262 KCG16081262 KCG16081350 KCG16081350 KCG16082557 KCG16082557 KCG16082894 KCG16082894 KCG16083050 KCG16083050 KCG16084099 KCG16084099 KCG16084235 KCG16084235 KCG16084368 KCG16084368 KCG16085090 KCG16085090 KCG16086814 KCG16086814 KCG16086939 KCG16086939 KCG16087247 KCG16087247 KCG16087314 KCG16087314 KCG16088110 KCG16088110 KCG16090935 KCG16090935 KCG16091315 KCG16091315 KCG16091332 KCG16091332 KCG16093310 KCG16093310 KCG16095190 KCG16095190 KCG16095605 KCG16095605 KCG16096093 KCG16096093 KCG16096210 KCG16096210 KCG16096378 KCG16096378 KCG17000153 KCG17000153 KCG17002690 KCG17002690 KCG17003614 KCG17003614 KCG17005356 KCG17005356 KCG17005496 KCG17005496 KCG17005644 KCG17005644 KCG17005947 KCG17005947 KCG17006984 KCG17006984 KCG17007087 KCG17007087 KCG17007390 KCG17007390 KCG17007635 KCG17007635 KCG17008158 KCG17008158 KCG17008900 KCG17008900 KCG17009372 KCG17009372 KCG17009532 KCG17009532 KCG17009604 KCG17009604 KCG17011782 KCG17011782 KCG17012420 KCG17012420 KCG17015455 KCG17015455 KCG17018612 KCG17018612 KCG17019954 KCG17019954 KCG17021070 KCG17021070 KCG17021239 KCG17021239 KCG17021245 KCG17021245 KCG17021749 KCG17021749 KCG17022183 KCG17022183 KCG17022444 KCG17022444 KCG17022933 KCG17022933 KCG17024355 KCG17024355 KCG17024591 KCG17024591 KCG17024943 KCG17024943 KCG17024946 KCG17024946 KCG17026213 KCG17026213 KCG17026678 KCG17026678 KCG17028436 KCG17028436 KCG17028994 KCG17028994 KCG17029576 KCG17029576 KCG17030140 KCG17030140 KCG17030216 KCG17030216 KCG17030990 KCG17030990 KCG17031010 KCG17031010 KCG17031396 KCG17031396 KCG17032445 KCG17032445 KCG17036192 KCG17036192 KCG17037636 KCG17037636 KCG17038408 KCG17038408 KCG17038879 KCG17038879 KCG17039003 KCG17039003 KCG17039626 KCG17039626 KCG17040868 KCG17040868 KCG17041006 KCG17041006 KCG17041168 KCG17041168 KCG17043674 KCG17043674 KCG17044304 KCG17044304 KCG17045148 KCG17045148 KCG17046246 KCG17046246 KCG17046367 KCG17046367 KCG17047922 KCG17047922 KCG17048364 KCG17048364 KCG17048381 KCG17048381 KCG17048832 KCG17048832 KCG17050656 KCG17050656 KCG17051552 KCG17051552 KCG17051983 KCG17051983 KCG17054213 KCG17054213 KCG17055702 KCG17055702 KCG17055875 KCG17055875 KCG17056026 KCG17056026 KCG17056200 KCG17056200 KCG17056685 KCG17056685 KCG17056952 KCG17056952 KCG17057222 KCG17057222 KCG17057845 KCG17057845 KCG17059125 KCG17059125 KCG17060315 KCG17060315 KCG17060792 KCG17060792 KCG17062555 KCG17062555 KCG17063186 KCG17063186 KCG17064188 KCG17064188 KCG17067173 KCG17067173 KCG17068572 KCG17068572 KCG17068720 KCG17068720 KCG17069092 KCG17069092 KCG17069535 KCG17069535 KCG17069797 KCG17069797 KCG17070448 KCG17070448 KCG17072177 KCG17072177 KCG17072852 KCG17072852 KCG17073278 KCG17073278 KCG17073302 KCG17073302 KCG17073857 KCG17073857 KCG17074529 KCG17074529 KCG17074661 KCG17074661 KCG17074725 KCG17074725 KCG17078641 KCG17078641 KCG17079153 KCG17079153 KCG17079211 KCG17079211 KCG17079426 KCG17079426 KCG17079606 KCG17079606 KCG17079678 KCG17079678 KCG17079700 KCG17079700 KCG17080037 KCG17080037 KCG17080264 KCG17080264 KCG17080689 KCG17080689 KCG17081084 KCG17081084 KCG17083066 KCG17083066 KCG17084178 KCG17084178 KCG17086800 KCG17086800 KCG17087339 KCG17087339 KCG17087932 KCG17087932 KCG17088394 KCG17088394 KCG17088425 KCG17088425 KCG17089095 KCG17089095 KCG17089102 KCG17089102 KCG17089178 KCG17089178 KCG17089214 KCG17089214 KCG17089540 KCG17089540 KCG17090644 KCG17090644 KCG17091409 KCG17091409 KCG17091778 KCG17091778 KCG17092191 KCG17092191 KCG17092264 KCG17092264 KCG17092375 KCG17092375 KCG17092705 KCG17092705 KCG17092840 KCG17092840 KCG17092916 KCG17092916 KCG18237340 KCG18237340 KCG17094154 KCG17094154 KCG17095059 KCG17095059 KCG17095460 KCG17095460 KCG17096179 KCG17096179 KCG17097454 KCG17097454 KCG17098177 KCG17098177 KCG17098913 KCG17098913 KCG17100344 KCG17100344 KCG17100526 KCG17100526 KCG17101261 KCG17101261 KCG17101746 KCG17101746 KCG17102287 KCG17102287 KCG17102627 KCG17102627 KCG17105234 KCG17105234 KCG17106010 KCG17106010 KCG17106918 KCG17106918 KCG17107598 KCG17107598 KCG17108081 KCG17108081 KCG17109343 KCG17109343 KCG17109629 KCG17109629 KCG17109863 KCG17109863 KCG17109991 KCG17109991 KCG17110269 KCG17110269 KCG17110319 KCG17110319 KCG17110502 KCG17110502 KCG17110529 KCG17110529 KCG17110693 KCG17110693 KCG17111061 KCG17111061 KCG17112064 KCG17112064 KCG17112108 KCG17112108 KCG17112913 KCG17112913 KCG17113604 KCG17113604 KCG17113667 KCG17113667 KCG17114022 KCG17114022 KCG17114069 KCG17114069 KCG17114739 KCG17114739 KCG17114917 KCG17114917 KCG17115046 KCG17115046 KCG17115814 KCG17115814 KCG17115873 KCG17115873 KCG17116104 KCG17116104 KCG17116292 KCG17116292 KCG17117572 KCG17117572 KCG17118522 KCG17118522 KCG17118527 KCG17118527 KCG17118685 KCG17118685 KCG17120003 KCG17120003 KCG17120174 KCG17120174 KCG17122080 KCG17122080 KCG17122099 KCG17122099 KCG17122256 KCG17122256 KCG17123796 KCG17123796 KCG17124109 KCG17124109 KCG17124133 KCG17124133 KCG17124950 KCG17124950 KCG17126429 KCG17126429 KCG17127242 KCG17127242 KCG17127668 KCG17127668 KCG17129048 KCG17129048 KCG17130502 KCG17130502 KCG17130769 KCG17130769 KCG17131036 KCG17131036 KCG17131792 KCG17131792 KCG17132614 KCG17132614 KCG17133368 KCG17133368 KCG17133545 KCG17133545 KCG17134194 KCG17134194 KCG17136703 KCG17136703 KCG17136972 KCG17136972 KCG17137418 KCG17137418 KCG17137648 KCG17137648 KCG17138066 KCG17138066 KCG17138274 KCG17138274 KCG17138804 KCG17138804 KCG17139850 KCG17139850 KCG17140279 KCG17140279 KCG17140802 KCG17140802 KCG17142442 KCG17142442 KCG17143029 KCG17143029 KCG17143228 KCG17143228 KCG17144512 KCG17144512 KCG17146032 KCG17146032 KCG17146252 KCG17146252 KCG17146509 KCG17146509 KCG17146624 KCG17146624 KCG17146834 KCG17146834 KCG17147051 KCG17147051 KCG17147092 KCG17147092 KCG17147334 KCG17147334 KCG17147620 KCG17147620 KCG17148084 KCG17148084 KCG17148529 KCG17148529 KCG17149327 KCG17149327 KCG17150078 KCG17150078 KCG17150770 KCG17150770 KCG17151243 KCG17151243 KCG17151447 KCG17151447 KCG17151490 KCG17151490 KCG17152288 KCG17152288 KCG17152359 KCG17152359 KCG17152369 KCG17152369 KCG17153346 KCG17153346 KCG17153490 KCG17153490 KCG17153921 KCG17153921 KCG18001588 KCG18001588 KCG18001788 KCG18001788 KCG18001970 KCG18001970 KCG18002505 KCG18002505 KCG18003991 KCG18003991 KCG18004152 KCG18004152 KCG18004264 KCG18004264 KCG18004415 KCG18004415 KCG18005027 KCG18005027 KCG18006651 KCG18006651 KCG18008794 KCG18008794 KCG18008873 KCG18008873 KCG18008996 KCG18008996 KCG18009121 KCG18009121 KCG18009144 KCG18009144 KCG18009366 KCG18009366 KCG18009672 KCG18009672 KCG18010296 KCG18010296 KCG18010551 KCG18010551 KCG18010757 KCG18010757 KCG18011039 KCG18011039 KCG18011193 KCG18011193 KCG18011729 KCG18011729 KCG18012007 KCG18012007 KCG18012165 KCG18012165 KCG18012772 KCG18012772 KCG18012834 KCG18012834 KCG18014026 KCG18014026 KCG18014985 KCG18014985 KCG18015778 KCG18015778 KCG18016563 KCG18016563 KCG18017822 KCG18017822 KCG18017894 KCG18017894 KCG18017931 KCG18017931 KCG18018060 KCG18018060 KCG18018132 KCG18018132 KCG18018657 KCG18018657 KCG18020267 KCG18020267 KCG18021372 KCG18021372 KCG18022173 KCG18022173 KCG18022735 KCG18022735 KCG18023691 KCG18023691 KCG18024032 KCG18024032 KCG18024178 KCG18024178 KCG18025481 KCG18025481 KCG18025540 KCG18025540 KCG18025851 KCG18025851 KCG18026066 KCG18026066 KCG18027031 KCG18027031 KCG18027217 KCG18027217 KCG18027305 KCG18027305 KCG18027411 KCG18027411 KCG18028103 KCG18028103 KCG18028452 KCG18028452 KCG18028887 KCG18028887 KCG18029537 KCG18029537 KCG18029606 KCG18029606 KCG18029689 KCG18029689 KCG18030656 KCG18030656 KCG18030946 KCG18030946 KCG18030956 KCG18030956 KCG18031240 KCG18031240 KCG18031334 KCG18031334 KCG18032376 KCG18032376 KCG18032438 KCG18032438 KCG18032832 KCG18032832 KCG18033319 KCG18033319 KCG18033670 KCG18033670 KCG18036301 KCG18036301 KCG18113393 KCG18113393 KCG18113549 KCG18113549 KCG18114857 KCG18114857 KCG18114987 KCG18114987 KCG18115455 KCG18115455 KCG18116913 KCG18116913 KCG18117129 KCG18117129 KCG18118769 KCG18118769 KCG18118900 KCG18118900 KCG18121111 KCG18121111 KCG18121526 KCG18121526 KCG18122007 KCG18122007 KCG18122088 KCG18122088 KCG18122562 KCG18122562 KCG18122637 KCG18122637 KCG18122974 KCG18122974 KCG18124470 KCG18124470 KCG18125812 KCG18125812 KCG18126067 KCG18126067 KCG18126184 KCG18126184 KCG18126452 KCG18126452 KCG18126567 KCG18126567 KCG18127238 KCG18127238 KCG18127697 KCG18127697 KCG18128091 KCG18128091 KCG18128553 KCG18128553 KCG18128576 KCG18128576 KCG18128740 KCG18128740 KCG18129435 KCG18129435 KCG18129994 KCG18129994 KCG18130499 KCG18130499 KCG18130712 KCG18130712 KCG18130714 KCG18130714 KCG18131874 KCG18131874 KCG18132034 KCG18132034 KCG18132775 KCG18132775 KCG18133033 KCG18133033 KCG18135707 KCG18135707 KCG18135928 KCG18135928 KCG18138283 KCG18138283 KCG18138469 KCG18138469 KCG18140287 KCG18140287 KCG18140350 KCG18140350 KCG18141914 KCG18141914 KCG18144406 KCG18144406 KCG18145354 KCG18145354 KCG18146153 KCG18146153 KCG18146213 KCG18146213 KCG18146796 KCG18146796 KCG18147938 KCG18147938 KCG18148350 KCG18148350 KCG18149060 KCG18149060 KCG18152276 KCG18152276 KCG18153386 KCG18153386 KCG18155380 KCG18155380 KCG18160132 KCG18160132 KCG18163148 KCG18163148 KCG18163702 KCG18163702 KCG18163982 KCG18163982 KCG18165562 KCG18165562 KCG18169452 KCG18169452 KCG18172936 KCG18172936 KCG18174697 KCG18174697 KCG18175689 KCG18175689 KCG18175727 KCG18175727 KCE18022446 KCE18022446 KCG18176453 KCG18176453 KCG18176885 KCG18176885 KCG18180322 KCG18180322 KCG18182785 KCG18182785 KCG18184620 KCG18184620 KCG18186853 KCG18186853 KCG18187725 KCG18187725 KCG18188655 KCG18188655 KCG18188928 KCG18188928 KCG18132431 KCG18132431 KCG18192144 KCG18192144 KCG18196519 KCG18196519 KCG18196751 KCG18196751 KCG18197197 KCG18197197 KCG18197454 KCG18197454 KCG18197874 KCG18197874 KCG18198452 KCG18198452 KCG18199456 KCG18199456 KCG18201502 KCG18201502 KCG18203727 KCG18203727 KCG18204155 KCG18204155 KCG18204388 KCG18204388 KCG18204755 KCG18204755 KCG18207006 KCG18207006 KCG18208422 KCG18208422 KCG18209849 KCG18209849 KCG18210622 KCG18210622 KCG18212606 KCG18212606 KCG18213914 KCG18213914 KCG18215750 KCG18215750 KCG18218986 KCG18218986 KCG18220794 KCG18220794 KCG18220838 KCG18220838 KCG18222061 KCG18222061 KCG18225222 KCG18225222 KCG18226433 KCG18226433 KCG18228004 KCG18228004 KCG18230510 KCG18230510 KCG18230571 KCG18230571 KCG18233519 KCG18233519 KCG18234865 KCG18234865 KCG18235544 KCG18235544 KCG18238146 KCG18238146 KCG18243679 KCG18243679 KCG18247389 KCG18247389 KCG18247678 KCG18247678 KCG18248211 KCG18248211 KCG18248700 KCG18248700 KCG18249799 KCG18249799 KCG18253246 KCG18253246 KCG18255030 KCG18255030 KCG18256264 KCG18256264 KCG18258348 KCG18258348 KCG18263255 KCG18263255 KCG18263641 KCG18263641 KCG18263935 KCG18263935 KCG18265873 KCG18265873 KCG18266973 KCG18266973 KCG18267894 KCG18267894 KCG18289800 KCG18289800 KCG18299000 KCG18299000 KCG18332352 KCG18332352 KCG18365466 KCG18365466 KCG19208617 KCG19208617 KCG19240537 KCG19240537 KCG19242521 KCG19242521 KCG19309243 KCG19309243 KCE17056268 KCE17056268 KCE17067072 KCE17067072 KCE17081513 KCE17081513 KCE17087719 KCE17087719 KCE17088553 KCE17088553 KCE17091479 KCE17091479 KCE17099251 KCE17099251 KCE17103169 KCE17103169 KCE17104534 KCE17104534 KCE17105221 KCE17105221 KCE17109238 KCE17109238 KCE17112754 KCE17112754 KCE17119826 KCE17119826 KCE17129660 KCE17129660 KCE17132879 KCE17132879 KCE17144637 KCE17144637 KCE18011494 KCE18011494 KCG16001190 KCG16001190 KCG16007165 KCG16007165 KCG16021737 KCG16021737 KCG16027051 KCG16027051 KCG16027437 KCG16027437 KCG16045833 KCG16045833 KCG16054150 KCG16054150 KCG16077783 KCG16077783 KCG16087151 KCG16087151 KCG16087763 KCG16087763 KCG16092127 KCG16092127 KCG16092795 KCG16092795 KCG17019792 KCG17019792 KCG17023487 KCG17023487 KCG17032913 KCG17032913 KCG17033659 KCG17033659 KCG17036124 KCG17036124 KCG17038389 KCG17038389 KCG17063503 KCG17063503 KCG17066440 KCG17066440 KCG17072496 KCG17072496 KCG17109325 KCG17109325 KCG17119934 KCG17119934 KCG17126978 KCG17126978 KCG17130072 KCG17130072 KCG17133846 KCG17133846 KCG17145391 KCG17145391 KCG18003654 KCG18003654 KCG18007586 KCG18007586 KCG18009282 KCG18009282 KCG18012284 KCG18012284 KCG18013747 KCG18013747 KCG18027915 KCG18027915 KCG18028519 KCG18028519 KCG18028575 KCG18028575 KCG18152367 KCG18152367 KCG18155623 KCG18155623 KCG18214010 KCG18214010 KCG18215124 KCG18215124 KCG18253037 KCG18253037 KCG19351154 KCG19351154".split(
        " ")
    list = "合同编号 KCG18145464 KCG18114184 KCG18123120 KCG18186448 KCQ17076833 KCG19279050 KCG19110815 KCG19234659 KCG19133049 KCG18148832 KCG17099211 KCG19208681 KCG19116525 KCG18031086 KCG17097815 KCE18198920 KCG18342991 KCG18362451 KCG18248446 KCG18320079 KCG18267616 KCG19133443 KCG19188082 KCG19246872 KCG19280067 KCG19207363 KCG19207419 KCG19234215 KCG19224212 KCG19251768 KCG19225849 KCG19292046 KCG19155160 KCG19112556 KCG19211232 KCG19193948 KCG19146614 KCG19197618 KCG19150303 KCG19190506 KCG19199571 KCG19164084 KCG19163187 KCG19150349 KCG19158512 KCG19170764 KCG19246272 KCG18162078 KCG18179604 KCG18185298 KCG18256842 KCG19233563 KCG18307500 KCG19198809 KCG18333314 KCG18117354 KCG19113034 KCG17112210 KCG17052650 KCG19151447 KCG17059628 KCG18339883 KCG17020874 KCG17003192 KCG17107890 KCE18022589 KCG19318111 KCG19349634 KCG18321484 KCG18350118 KCG18321719 KCG18326894 KCG19208124 KCG18251327 KCG19235796 KCG19212119 KCG19263009 KCG19233671 KCG19251056 KCG19271942 KCG19234024 KCG19209578 KCG19199902 KCG19231218 KCG19240064 KCG19158649 KCG19152185 KCG19150235 KCG19200514 KCG19173514 KCG19140658 KCG19148990 KCG19205437 KCG19158465 KCG19180293 KCG19140723 KCG19110913 KCG19113690 KCG19144536 KCG18303189 ".split(
        " ")
    # comFileDirName(path,list)

    # fileClass(r"Y:\海通 第二批8-27\海通第二批1600单\证据包\海通1400+100原始资料\9-14资料补充\身份证\担保人朋友身份证补充-9.14\担保人朋友身份证补充-9.14",
    #           r"Y:\海通 第二批8-27\海通第二批1600单\证据包\海通1400+100原始资料\9-14资料补充\身份证\sfz"
    #           , r"Y:\海通 第二批8-27\海通第二批1600单\证据包\海通1400+100原始资料\9-14资料补充\身份证\有朋友担保无身份-补充9.14.xlsx"
    #           , [1], [0, 5, 1, 5, 2])
    # classDir(r"C:\Users\jin\Desktop\执行\九月份执行200",r"C:\Users\jin\Desktop\新建文件夹\执行完毕",r"C:\Users\jin\Desktop\执行完毕.xlsx")
    # compNotFileDirName(path2,list)
    # destination = r"C:\Users\jxh\Desktop\百信完整版-26"
    # margerDir(r"C:\Users\Administrator\Desktop\2-4",r"C:\Users\Administrator\Desktop\2020.6.2执行100个案件")
    # margerDir(r"C:\Users\Administrator\Desktop\2020.6.2执行100个案件",r"C:\Users\Administrator\Desktop\终结执行")
    # 移动文件夹 从path1 移动到path2 针对判决书 里面文件名称相同
    # moveFile1(r"Y:\花\法智通6月诉讼材料包\1100\1100人里面前500人",r"Y:\caojia\6月份\yr-bx-021")

    # 将文件名称包含filterNames名称的从dir目录复制到newDir
    # filterNames =r"7-3.2纸质判决书邮寄送达回执1.PNG,7-3.2纸质判决书邮寄送达回执2.PNG,7-3.2纸质判决书邮寄送达回执1.png,7-3.2纸质判决书邮寄送达回执2.png"
    # extractFile(r'E:\备份资料\2020.5\备份证据四月份\2020.5\执行',filterNames,  r'Y:\曹佳\新六月执行')

    # 提取文件夹，根据案号提取文件夹出来
    filterNames = r""
    # extractDir(r"Y:\曹佳\222\yr-bx2-002",filterNames, r"Y:\曹佳\新建文件夹")

    # 提取文件夹，根据名称提取文件夹出来
    # filterNames =r"田景勇,杨东升,赵菲,"
    # extractDir1(r"C:\Users\cw\Desktop\2",filterNames, r"C:\Users\cw\Desktop\1")

    # MoveOneFile(myfile,path,destination)
    # RenameFile("道德经.txt",path,"道德经1.txt")
    # extractFile2(destination,r"C:\Users\jxh\Desktop\2")
